<%@page import="com.neiquan.backstage.pub.bsc.dao.po.Entrepreneur"%>
<%@page import="com.neiquan.backstage.resourec_manage.EntrepreneurService"%>
<%@page import="com.neiquan.backstage.platform_alliance_member.PlatformAllianceMemberService"%>
<%@page import="com.neiquan.backstage.pub.bsc.dao.po.PlatformAllianceMember"%>
<%@page import="com.neiquan.backstage.event.EventService"%>
<%@page import="com.neiquan.backstage.pub.bsc.dao.po.Event"%>
<%@page import="java.util.List"%>
<%@page import="com.neiquan.backstage.common.CommonService"%>
<%@page import="com.neiquan.backstage.common.util.SpringContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
ApplicationContext appCtx = SpringContextUtils.getApplicationContext();
CommonService commonService = appCtx.getBean(CommonService.class);
EntrepreneurService entrepreneurService = appCtx.getBean(EntrepreneurService.class);
String memberId1=request.getParameter("memberId");
int id=Integer.parseInt(memberId1);
List<Entrepreneur> entrepreneurs = entrepreneurService.queryAllChecked(id);
pageContext.setAttribute("entrepreneurs", entrepreneurs);

%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta charset="UTF-8">
	<title>用户注册</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1.0" />
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<link rel="stylesheet" href="css/base.css" />
	<link rel="stylesheet" href="css/main.css" />
	</head>
	<body bgcolor="#f0f0f0" id="app" ng-app="app" ng-controller="ctrl">
		<section>
			<section class="reister-top mt">
				<span class="common_bg register-part register-part-on">
					创始人
				</span>
				<span class="common_bg register-part visitor">
					合伙人/员工
				</span>
			</section>
			<section class="register-detail">
				<section class="mt register-item">
					<section class="mt register-item-bottom">
						<p class="signup-title pd">申请人信息</p>
						<section class="line"></section>
						<section class="tc">
							<form id="registerform1" class="fom">
								<p class="form-inpt-p">
									<label>姓名</label><input ng-model="name1" class="inpt" form="registerform1" name="username" type="text" placeholder="请输入您的真实姓名" />
								</p>
								<p class="form-inpt-p" >
									<label>公司名称</label><input ng-model="entrepreneurName1" class="inpt" form="registerform1" name="companyname" type="text" placeholder="请输入您的公司全称" />
								</p>
								
								<p class="form-inpt-p">
									<label>手机号</label><input ng-model="phone1" class="inpt" form="registerform1" name="tel" type="tel" placeholder="请输入您的手机号码" />
								</p>
								<p class="form-inpt-p">
									<label>密码</label><input ng-model="pwd1" class="inpt pwd" form="registerform1" name="pwd" type="password" placeholder="6-20个数字或者字母" />
								</p>
								<p class="form-inpt-p">
									<label>重复密码</label><input ng-model="pwdr1" class="inpt repeatpwd" form="registerform1" name="pwd" type="password" placeholder="请重复输入您的密码" />
								</p>
								<!-- <p class="form-inpt-p">
								<label>验证码</label><input ng-model="smsCode1" class="inpt identifycode" form="registerform1" required name="identify" type="text" />
									<button class="btn getcode" ng-click="smsVerify1()">获取验证</button>
								</p> -->
								<button class="btn fom-submit register-sub" form="registerform2" type="submit" ng-click="sumbit1()">提交申请</button>
							</form>
						</section>
					</section>
				</section>
				<section class="mt register-item">
					<section class="mt register-item-bottom">
						<p class="signup-title pd">申请人信息</p>
						<section class="line"></section>
						<section class="tc">
							<form id="registerform2" class="fom" >
								<p class="form-inpt-p">
									<label>姓名</label><input ng-model="name2" class="inpt" form="registerform2" name="username" type="text" placeholder="请输入您的真实姓名" />
								</p>
								<p class="form-inpt-p" >
								<section class="relative tc incubator-select-wrap pd tc">
								公司<input readonly="readonly" id="entrepreneurName2" type="text" placeholder="请选择" class="addr_inpt incubator-inpt inpt" />
							 	<ul class="incubator_select area_select" style="display: none">
									<c:forEach var="entrepreneur" items="${pageScope.entrepreneurs}">
									<li>${entrepreneur.name}</li>
								</c:forEach>
							</ul>
							</section>
								</p>
								<p class="form-inpt-p">
									<label>手机号</label><input ng-model="phone2" class="inpt" form="registerform2" ng-model="phone" name="tel" type="tel" placeholder="请输入您的手机号码" />
								</p>
								<p class="form-inpt-p">
									<label>密码</label><input ng-model="pwd2" class="inpt pwd" form="registerform2" name="pwd" type="password" placeholder="6-20个数字或者字母" />
								</p>
								<p class="form-inpt-p">
									<label>重复密码</label><input ng-model="pwdr2" class="inpt repeatpwd" form="registerform2" name="pwd" type="password" placeholder="请重复输入您的密码" />
								</p>
								<!-- <p class="form-inpt-p">
								<label>验证码</label><input ng-model="smsCode2" class="inpt identifycode" form="registerform2" required name="identify" type="text" />
									<button class="btn getcode" ng-click="smsVerify2()">获取验证</button>
								</p> -->
								<button class="btn fom-submit register-sub" form="registerform2" type="submit" ng-click="sumbit2()">提交申请</button>
							</form>
						</section>
					</section>
				</section>
			</section>
		</section>
	</body>
	<script src="js/jquery.min.js"></script>
	<script src="angular-1.5.0-rc.2/angular.js"></script>
	<script src="js/main.js"></script>
	<script src="js/responsive.js"></script>
	<script>
	var app = angular.module("app", []);
	app.controller('ctrl', function($scope, $http, $httpParamSerializer, $injector, $window) {
	
	$scope.sumbit2 = function(){
		var reqDate = jQuery.param({
			"name": $scope.name2,
			"entrepreneurName": document.getElementById("entrepreneurName2").value,
			"phone": $scope.phone2,
			"password": $scope.pwd2,
			"memberId": "${param.memberId}",
			"smsCode":$scope.smsCode2,
			"passwordr":$scope.pwdr2,
			"type":'2'
		});
		var reqConfig = { headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"} };
		$http.post(
			"api/user/add", reqDate,reqConfig
		).success(function(data, status) {
			if (data.code != 0) {
				alert(data.errorMessage);
				return;
			} 
			$window.location.href = "checking.jsp?memberId=${param.memberId}";
		}).error(function(data, status) {
			showNetworkErrMsg(data, status);
		});
	};
	$scope.sumbit1 = function(){
		var reqDate = jQuery.param({
			"name": $scope.name1,
			"entrepreneurName": $scope.entrepreneurName1,
			"phone": $scope.phone1,
			"password": $scope.pwd1,
			"memberId": "${param.memberId}",
			"passwordr":$scope.pwdr1,
			"type":'1'
		});
		var reqConfig = { headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"} };
		$http.post(
			"api/user/add", reqDate,reqConfig
		).success(function(data, status) {
			if (data.code != 0) {
				alert(data.errorMessage);
				return;
			} 
			$window.location.href = "checking.jsp?memberId=${param.memberId}";
		}).error(function(data, status) {
			showNetworkErrMsg(data, status);
		});
	};
	
	//获取验证码
	var n = 60
		jQuerycode = jQuery('.getcode');
	function num(){
		jQuerycode.text(n);
		n-=1;
		b=0;
		if(n < 0){
			jQuerycode.text("重新获取").css('background','#DD1215');
			clearInterval(myTime);
			n=60;
		}
	}
	$scope.smsVerify1=function(){
		if(n==60){
		myTime = setInterval(num,1000);
		setTimeout(function(){
			jQuerycode.css('background','#ccc');
		},1000);
		var param = {
				"phone": $scope.phone1
			}; 
			jQuery.post("api/user/smsVerify", param, function(data) {
				if (data.code != 0) {
					alert(data.errorMessage);
					return;
				} 
			});
		}
	};
	$scope.smsVerify2=function(){
		if(n==60){
		myTime = setInterval(num,1000);
		setTimeout(function(){
			jQuerycode.css('background','#ccc');
		},1000);
		var param = {
				"phone": $scope.phone2
			}; 
			jQuery.post("api/user/smsVerify", param, function(data) {
				if (data.code != 0) {
					alert(data.errorMessage);
					return;
				} 
			});
		}
	};
});
</script>
<script>

</script>
</html>
